package services;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import authentication.UserDetailsImpl;

@Service("HWUserDetailsService")
public class UserDetailsServiceImpl implements UserDetailsService
{

	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException 
	{
		if (username.equals("111") || username.equals("222") || username.equals("333"))
		{
			UserDetailsImpl userDetails = new UserDetailsImpl();
			userDetails.setUsername(username);
			userDetails.setPassword("1");
			userDetails.setAccountNonExpired(true);
			userDetails.setAccountNonLocked(true);
			userDetails.setCredentialsNonExpired(true);
			userDetails.setEnabled(true);
			return userDetails;
		}
		throw new UsernameNotFoundException("Username not found:" + username);
	}

}
